// 用户个人应聘

var MyApply = Vue.component('MyApply', {
    props: [''],
    data: function () {
        return {
            tableData: [],
            page: {
                totalPage: 10,
                totalNum: 1,
                pageNum: 10
            }
        }
    },
    created() {
        console.log("请求数据")
        var self = this
        $.ajax({
            type:"POST",
            url: _UrlPrefix + "/api/app/call/myyingpin",
            data: {
                page: 0,
                app_access: _AppAccess,
                token:'kmAvL4tmwmmC2SWrDPcCU3hHcrZY4Z7f5k8vVV328cJpFFS3ZALE75x8tgfuxPJpLAsMbExP'
            },
            success:function(res){
                if(200 == res.code || 0 == res.code) {
                    console.log("res: ", res)
                    self.tableData = res.data
                }
            }
        })
    },
    methods: {
        onResume: function () {
            console.log("预览简历")
        },
        onView: function (_id) {
            console.log("查看：", this.tableData[_id])
        },
        givePageFun: function () {
            console.log("切换页数")
        }
    },
    template: `<div class="my-apply">
            <div class="apply-header">
                <div class="apply-header-name">应聘列表</div>
                <button class="apply-header-resume" @click="onResume">我的简历预览</button>
            </div>
            <div class="apply-table apply-table-header apply-index">
                <table>
                    <tr>
                        <th>公司名称</th>
                        <th>职位</th>
                        <th>联系人</th>
                        <th>昵称</th>
                        <th>地址</th>
                        <th>月薪</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    <tr v-for="value in tableData" v-key="value.id">
                        <td>{{value.company_name}}</td>
                        <td>{{value.jobName}}</td>
                        <td>{{value.contact}}</td>
                        <td>{{value.cname}}</td>
                        <td>{{value.address}}</td>
                        <td>{{value.emolument}}</td>
                        <td v-if="value.status === 1">投递中</td>
                        <td v-else-if="value.status === 2">拒绝投递</td>
                        <td v-else-if="value.status === 3">面试邀请</td>
                        <td v-else-if="value.status === 4">拒绝邀请</td>
                        <td v-else-if="value.status === 5">面试失败</td>
                        <td v-else-if="value.status === 6">面试成功</td>
                        <td v-else>评价</td>
                        <td><a href="./StaffInfo.html#/apply/detail" @click="onView(value.id)">查看</a></td>
                    </tr>
                </table>
            </div>
            <!--
            <div class="apply-table apply-table-footer">
                <common-page :getPage="page" @givePageFun="givePageFun"></common-page>
            </div>
            -->
        </div>`
})